﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class RC_Personals : System.Web.UI.Page
    {
        IPersonalBLL person = new PersonalBLL();
        PersonalInfo personInfo = new PersonalInfo();

        protected void Page_Load(object sender, EventArgs e)
        {
            RadGrid1.DataSource = person.LoadGridPersonals();
        }

        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                string seq = (e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["person_seq"].ToString();

                personInfo.PersonSeq = seq.Length > 0 ? Int32.Parse(seq) : (int?)null;
                person.Delete(personInfo);
            }

            RadGrid1.DataSource = person.LoadGridPersonals();
        }
    }
}
